//
//  TTOpenShopCollectionViewCell.m
//  TaoTuo
//
//  Created by admin on 2019/11/5.
//  Copyright © 2019 admin. All rights reserved.
//

#import "TTOpenShopCollectionViewCell.h"
#import "TTOpenShopViewController.h"

@interface TTOpenShopCollectionViewCell ()

@property (nonatomic, strong) UIImageView *imageView;
@property (nonatomic, strong) UILabel *titleLabel;
@property (nonatomic, strong) UILabel *subTitleLabel;

@end

@implementation TTOpenShopCollectionViewCell

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        
        self.backgroundColor = [UIColor whiteColor];
        
        [self setupSubviews];
        
    }
    return self;
}

- (void)setModel:(TTOpenShopModel *)model
{
    _model = model;
    self.imageView.image = [UIImage imageNamed:model.imageName];
    self.titleLabel.text = model.title;
    self.subTitleLabel.text = model.subTitle;
}

- (void)setupSubviews
{
    _imageView = [[UIImageView alloc] init];
    [self.contentView addSubview:_imageView];
    [_imageView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self);
        make.centerX.equalTo(self);
        make.width.height.mas_equalTo(60);
    }];
    
    _titleLabel = [UILabel labelWithTitle:@"" color:UIColorHex(4E453A) fontSize:15];
    [self.contentView addSubview:_titleLabel];
    [_titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.imageView.mas_bottom).mas_offset(10);
        make.centerX.equalTo(self);
    }];
    
    _subTitleLabel = [UILabel labelWithTitle:@"" color:UIColorHex(999999) fontSize:10];
    [self.contentView addSubview:_subTitleLabel];
    [_subTitleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.titleLabel.mas_bottom).mas_offset(10);
        make.centerX.equalTo(self);
    }];
    
}

@end
